using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Domain.Entidades;
namespace Data.Models.Mapping
{
    public class VW_permissoesMap : EntityTypeConfiguration<VW_permissoes>
    {
        public VW_permissoesMap()
        {
            // Primary Key
            this.HasKey(t => new { t.usu_codigo, t.perm_codigo, t.perm_modulo, t.perm_descricao });

            // Properties
            this.Property(t => t.usu_codigo)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.perm_codigo)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.perm_modulo)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.perm_descricao)
                .IsRequired()
                .HasMaxLength(100);

            // Table & Column Mappings
            this.ToTable("VW_permissoes");
            this.Property(t => t.usu_codigo).HasColumnName("usu_codigo");
            this.Property(t => t.perm_codigo).HasColumnName("perm_codigo");
            this.Property(t => t.perm_modulo).HasColumnName("perm_modulo");
            this.Property(t => t.perm_descricao).HasColumnName("perm_descricao");
        }
    }
}
